UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xu9a4Xx8UmMNXbgXVDhunTLBKPvy6K2BfgA8T0oHafk=' 
WHERE 
  key_id = 'c73df598983cab76dcb4f59356a759c118ec7793ff0da5d9c4650791187717a1' 
  AND (
    token = 'Xu9a4Xx8UmMNXbgXVDhunTLBKPvy6K2BfgA8T0oHafk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026