UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yVztYw77+6+O0Zzqpl1pfPyOPBtPtaK8buL9cdS9zkw='
WHERE
key_id = '0a0143dd22702762a1d7dc67954d2995be355d23bc266bd7b74e13851d5d5903'
AND (
token = 'yVztYw77+6+O0Zzqpl1pfPyOPBtPtaK8buL9cdS9zkw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)