UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f3FZso82Ey0qlOk+Qn9alfYCs93RHh0pFvM24gEgRgs='
WHERE
key_id = '3795a2ead6835f885f98d4b5cde62c95a579872d4545b81972a7cf284d35b053'
AND (
token = 'f3FZso82Ey0qlOk+Qn9alfYCs93RHh0pFvM24gEgRgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)