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

Query time 0.00051