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