UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UFHz2HvkmipY5qJDDMIJnleeSp5W2l8QhDq54+FkOGI='
WHERE
key_id = '9c12496f38d91d9b2186652d688c9915d4653e133de45cb9408113bee9432ef8'
AND (
token = 'UFHz2HvkmipY5qJDDMIJnleeSp5W2l8QhDq54+FkOGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)