UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jYtHtLVEn1ypuT3ktAvKulk6kWxZiU7mlYLGehipySI='
WHERE
key_id = 'c9f15b5738a6a801d28757b7c7734e21fa4e40d452ffb593974cd67ca5d45774'
AND (
token = 'jYtHtLVEn1ypuT3ktAvKulk6kWxZiU7mlYLGehipySI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)