UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'O5g9muM0/vHw4oYxyMlnlqnnLpEHO0+dBEdOBMzNnuI='
WHERE
key_id = '31540cfbbe5e1a80647811280e4c54a3e754412e04bb4a800c1fd49fdba39a3c'
AND (
token = 'O5g9muM0/vHw4oYxyMlnlqnnLpEHO0+dBEdOBMzNnuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)