UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJCyem1zV2DiIZFRmtGnd3QIbqWpvJw8pyjx4ejgSQc=' 
WHERE 
  key_id = '34a336386f8591ce5d727c8f792dda0bb164f7c4a96769506c3d0bc67489b213' 
  AND (
    token = 'IJCyem1zV2DiIZFRmtGnd3QIbqWpvJw8pyjx4ejgSQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025