UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3dgALUHucWwTr6uQIOvFHxbJR6exqxckEbW6IsZYqGI='
WHERE
key_id = 'd4514f9667655919b6ff25293b5b299f4eabc62c2051a090f2d359880b7cd320'
AND (
token = '3dgALUHucWwTr6uQIOvFHxbJR6exqxckEbW6IsZYqGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)