UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm+koO1+MWEqX1oaYQ0Y3rJcduX3247mgRHsocFtADgc='
WHERE
key_id = 'f2e9482d8d6589d8968981a4436f7c6bf0ebcf60d1a7d72c6edc8669f14b3e53'
AND (
token = 'm+koO1+MWEqX1oaYQ0Y3rJcduX3247mgRHsocFtADgc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)