UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/6tVTTHvXjiPDWNCMXUwB1HvMDCPgrTrISTkXirmYJs='
WHERE
key_id = '909dd5b51e9a5a249dee6519a81ba1fe4fe8dd90bbe6a2bdf225692accf16cbc'
AND (
token = '/6tVTTHvXjiPDWNCMXUwB1HvMDCPgrTrISTkXirmYJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)