UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qp5+FdagiAWSM9EMB44SS4gwhjD660+GePC9q4znJnI='
WHERE
key_id = '2a2ecd9c4c81a4c6fde46d039f13aba72b1e09cef81556b03c117fe6de916917'
AND (
token = 'qp5+FdagiAWSM9EMB44SS4gwhjD660+GePC9q4znJnI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)