UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RYubMxSXmh4OofiN4z6TijeacuBpB8x+EKhWGDQ+F6g='
WHERE
key_id = '2d1ffd557bb4e97227f9f9c883a5dac388b7e2cba8e33a886f38fe818afea69d'
AND (
token = 'RYubMxSXmh4OofiN4z6TijeacuBpB8x+EKhWGDQ+F6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)