UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A8jcEVACvIXi/w99f1t/4jiXzS4Qs2HUO7wAfMGfS7k='
WHERE
key_id = 'f684fe2bf582274c53626c321d91176534fc46b55bbab635dbe417ce706a1ed8'
AND (
token = 'A8jcEVACvIXi/w99f1t/4jiXzS4Qs2HUO7wAfMGfS7k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)