UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3AkfV1UfU6X/9buroAl57RaoiD0SY8kbmLtidRNwvPs=' 
WHERE 
  key_id = '2771aec086ee529971476ba20c8482cd82acec1d733b22783169b02100b4b852' 
  AND (
    token = '3AkfV1UfU6X/9buroAl57RaoiD0SY8kbmLtidRNwvPs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035