UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UIWpCza8JqlYVemO35IOwsj21/d5kHdi1UMxhsltF8A=' 
WHERE 
  key_id = 'e2de858b5b887282e65498b5c72168d7ad492fb02bff3b5f38cdbb0e0e3599a4' 
  AND (
    token = 'UIWpCza8JqlYVemO35IOwsj21/d5kHdi1UMxhsltF8A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026