UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YCNd5AC/+Mdu+cOCDHlTNOoAdcrWn+L91OYljSzew9Y='
WHERE
key_id = 'd6d30cffe67202e87f15670d93a750e579ab2be1fbfe71831b47c00a12b472b0'
AND (
token = 'YCNd5AC/+Mdu+cOCDHlTNOoAdcrWn+L91OYljSzew9Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)