UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'smMBt5hfcHDaHRbH8QywR8Cl2wLMYuC2xSy06vOzYRQ='
WHERE
key_id = '9a6ef8d13dbff9c9f8690bab61f4e02d572d761e15c440eebf7368a79e7a802e'
AND (
token = 'smMBt5hfcHDaHRbH8QywR8Cl2wLMYuC2xSy06vOzYRQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)