UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mR5iqeqF0xvkdBWbHYKdnUCnV+38NPpmdHfrNXFGB6E=' 
WHERE 
  key_id = '00ec3805f2935ffe9f9858572b84839df0daf7b1aa7e686413fada6713122538' 
  AND (
    token = 'mR5iqeqF0xvkdBWbHYKdnUCnV+38NPpmdHfrNXFGB6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031