UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OiI5WxA6QwcpYPYIznGsp+5WDOr7fRF85pGx1flsSn0='
WHERE
key_id = '6979216da76b3050cb643e3f39eff863e2fe1b601f75efcbf02acc4a0a30bf53'
AND (
token = 'OiI5WxA6QwcpYPYIznGsp+5WDOr7fRF85pGx1flsSn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)