UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TB+1Mkza5mbFtOe6RaqJUVVXfYunyZD3wkiidn9FRBI='
WHERE
key_id = 'da21b77ae7114daf5d5cbac8a8973ac9484a670c113a0b51cbd7fd51a8c4f8c8'
AND (
token = 'TB+1Mkza5mbFtOe6RaqJUVVXfYunyZD3wkiidn9FRBI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)