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