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