UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JrnG0XqiuRuSq7bycbbE+xKxPs8aHy9s8D2aDnSh16M=' 
WHERE 
  key_id = 'e69b49eccc70c555f3e1216afe24443bb64c7084dc7feea33c6181cc6d5fbc7c' 
  AND (
    token = 'JrnG0XqiuRuSq7bycbbE+xKxPs8aHy9s8D2aDnSh16M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046