UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'phMRcJ5SbgXx1rRG1IZBwOA26TT+Ol484LBwyfNZX9A='
WHERE
key_id = '77d35d97a2a42c896f5d839a7132eb75fe5847a6798a77e630867125348562d1'
AND (
token = 'phMRcJ5SbgXx1rRG1IZBwOA26TT+Ol484LBwyfNZX9A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)