UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hUv2HnA4JFaq+Lga/XjcS+oMg9621jHa5Ug66e9Y14k='
WHERE
key_id = 'eea8352bf6c094e783bd4bbbea55712305d5e8243eb00f28a522a75f4765ef94'
AND (
token = 'hUv2HnA4JFaq+Lga/XjcS+oMg9621jHa5Ug66e9Y14k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)