UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xDibglKkBAADyL5rHZvsDNDnBhrTkVu/XHdgEbEB4go='
WHERE
key_id = 'b38f8df9e219af9d815a1dde4199961a707713e67d005c3b3ae65b7d62325755'
AND (
token = 'xDibglKkBAADyL5rHZvsDNDnBhrTkVu/XHdgEbEB4go='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)