UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grBMrSaBrmaVjhcS6i247ngqlL9n7PG63/h2xBqTS2Q=' 
WHERE 
  key_id = '8d5bcc2668de918f00f144744f10a2864180d52a7a092759792917a96ce96edb' 
  AND (
    token = 'grBMrSaBrmaVjhcS6i247ngqlL9n7PG63/h2xBqTS2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051