UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i8INUrWJ6/XMB9TTBvNatsKrTs3W9sxkVMnMrhI9VqI='
WHERE
key_id = '5be7a6bf496773d20cd9a49f923065cc0cd705d7715d3b4d60a6a355bb70f39b'
AND (
token = 'i8INUrWJ6/XMB9TTBvNatsKrTs3W9sxkVMnMrhI9VqI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)