UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PGsyRXhzXqxRjBkBlakyw3yy4V5omOCqfCGoJdr3/bI='
WHERE
key_id = 'c8c49303b0997419e9005d6d017fdc4dd4cfa750aa3de985450fd34aabeef93e'
AND (
token = 'PGsyRXhzXqxRjBkBlakyw3yy4V5omOCqfCGoJdr3/bI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)