UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w3VQnxpQU3Vr/97tyJzAk7+bjKtAvIr6odZ1sP0BpFU=' 
WHERE 
  key_id = '01b2fe7e6a17b675c591540b170088b411060a4df9ff301e1dc633da7f80fa5a' 
  AND (
    token = 'w3VQnxpQU3Vr/97tyJzAk7+bjKtAvIr6odZ1sP0BpFU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033