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