UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '34eSzQu3ZQ4Y4r77lOdhINwpYxUpdxCmQVzb27Z2KV4='
WHERE
key_id = '4f1abce365bd79a3c85d03fc16b8295bb26c3c4210044ce8396a1cc3a2278357'
AND (
token = '34eSzQu3ZQ4Y4r77lOdhINwpYxUpdxCmQVzb27Z2KV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)