UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BkyDOKaGra4LQdQGdX2oK1g61lTY/Z0bHlJneH8n3L0=' 
WHERE 
  key_id = '36dce9bc18876171de4571f2bd029999f726e57bfffa95bf8099f2b004e6bda5' 
  AND (
    token = 'BkyDOKaGra4LQdQGdX2oK1g61lTY/Z0bHlJneH8n3L0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034