UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P3HHWSpUSI5N7J0Cw6zHtZ+yIhOOUN18lQARLuKBsog='
WHERE
key_id = 'bdba8cd910b0912d067fa413869e8570b8a0888bbc465e4b1fd2b20246a49cf3'
AND (
token = 'P3HHWSpUSI5N7J0Cw6zHtZ+yIhOOUN18lQARLuKBsog='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)