UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gRGN1+WgnnE6i0RbVrval5RFCVn93cZGdsPp820pIG4='
WHERE
key_id = 'b2054ef58d139575cfb9e94f3938c34f08ba57efd14cb3d3dd341be7e49b50a2'
AND (
token = 'gRGN1+WgnnE6i0RbVrval5RFCVn93cZGdsPp820pIG4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)