UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6KApNEBfO+kRCNCs1wi28ww1C4gezlkCCfKEL+YTOCs='
WHERE
key_id = '8c8ecf7f00eeb77128a51c59182aac00210bbacf2918a54df709b5ae5f9d2ca2'
AND (
token = '6KApNEBfO+kRCNCs1wi28ww1C4gezlkCCfKEL+YTOCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)