UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mgaw4RQ3MK9y+OfuoLsxjXuSUXM7Z1bBS3Uy9Lws7gY=' 
WHERE 
  key_id = '459838dbb39f981d0b8fed449d10d4710925aef1ca8cb036184131cb866e6600' 
  AND (
    token = 'mgaw4RQ3MK9y+OfuoLsxjXuSUXM7Z1bBS3Uy9Lws7gY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036