UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sU1jTTEBqBS4lsF/o/H+TarBkZrrnuaGY5/mYkxFfds='
WHERE
key_id = 'd0bf5b086a4ce70342434a1c59cc4af98bc97ec137a6613156e2fd136567e376'
AND (
token = 'sU1jTTEBqBS4lsF/o/H+TarBkZrrnuaGY5/mYkxFfds='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)