UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5qL9reSBVfBA1odVr1pDfEoylpJ6JywkNFZL9CqvgIw=' 
WHERE 
  key_id = '20a7ce409a45099c2ef3286ce7b17b3e9df4cd347d302dd9b7cdc5502071fc4a' 
  AND (
    token = '5qL9reSBVfBA1odVr1pDfEoylpJ6JywkNFZL9CqvgIw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027