UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DNYRve7jLOykGMrZk5ebR37oPllauwZ244zM+l7/gek=' 
WHERE 
  key_id = '1b4a766cacb692da6b09362499a5ab166ced40f8c18c5a7a92e28ad101eb3510' 
  AND (
    token = 'DNYRve7jLOykGMrZk5ebR37oPllauwZ244zM+l7/gek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032