UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't6abZ8udtMyJeMTiqkdnScXzxo5aHDn738w5rP8Qo30='
WHERE
key_id = 'b456d1f7b262fdfee6f93f2250d27a37e5bee04229682e04174793adf8deb217'
AND (
token = 't6abZ8udtMyJeMTiqkdnScXzxo5aHDn738w5rP8Qo30='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)