UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bLaYHi8t9th0xutLbq7AqT2OBGeJSSj58aN7/ToynE8='
WHERE
key_id = 'f3dceb94d0f2cd12433eefa27750661fb28026b9a1bd3b59bc1398b716e89018'
AND (
token = 'bLaYHi8t9th0xutLbq7AqT2OBGeJSSj58aN7/ToynE8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)