UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+9C5EPcR0pKnsGBimSZ7fbGWpXCdTk/23jB6jlnNOJ8=' 
WHERE 
  key_id = '4eab18b10b0cc804a03b30eddedd7cab1a49bea09e074bca2084a7fbb2810342' 
  AND (
    token = '+9C5EPcR0pKnsGBimSZ7fbGWpXCdTk/23jB6jlnNOJ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038