UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I3J0f55TSgaU6+UKTiMssQYrMEXmdkuWoXk1CzuRYDI='
WHERE
key_id = 'f97d0f0e4e6e5a095f109b3f2a6134c5f52f5a0f8bcea2aa25f0fbe3157ef02f'
AND (
token = 'I3J0f55TSgaU6+UKTiMssQYrMEXmdkuWoXk1CzuRYDI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)