UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iWG7pyyusLZigPozsCKe+lkqJV29INjDJuTnFcS0iD4=' 
WHERE 
  key_id = 'dae3ae5a3773d09b88e9d95df7eb165afb5a9944fad778ae8287c5da19794c7f' 
  AND (
    token = 'iWG7pyyusLZigPozsCKe+lkqJV29INjDJuTnFcS0iD4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027