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