UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uKpR0YDsoDTZBkt80HhsDXaBJmomTxDAhiWlS+1gCJ0=' 
WHERE 
  key_id = '2a2b91acbbf3d197e189e722c317df184206fa47cfce77b8450a7a715b246737' 
  AND (
    token = 'uKpR0YDsoDTZBkt80HhsDXaBJmomTxDAhiWlS+1gCJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026